<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>鼠标单击事件</title>
    <script src="../../vue/vue.js"></script>
    <!-- <script src="../works/Squary/js/jquery-3.6.0.min(1).js"></script> -->

</head>
<body>
    <!-- 创建根节点 -->
    <div id="app">
        <!-- 差值符 -->
        <p>{{msg}}</p>
        <p>点击按钮把旧文本修改为新文本</p>
        <button v-on:click="onClick">点击</button>
        <button @click="onClick">点击</button>

    </div>
    
</body>
<script>
    // 创建vue实例
    var vm=new Vue({
        el:'#app',
        data:{
            msg:"旧文本"
        },

        methods: {
            onClick(){
                return this.msg = "新文本"
            }

        },
        // 钩子函数
        beforeCreate(){
                console.log("before")

            },
            created(){
                console.log("created")
            },
            updated(){
                console.log("updated")
            }
    })
</script>
</html>